#include <iostream>  
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>

void handler(int sig)
{
    std::cout << "get a sig:" << sig << std::endl;
    exit(1);
}

int main()
{
    int cnt = 1;
    signal(SIGALRM, handler);

    alarm(5);
    sleep(4);

    int n = alarm(0); 

    std::cout << "n : " << n << std::endl;
    
    return 0;
}